<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('bookstore.return')} > ${i18n.getMessage('edit')}">
	<a href="#" onclick="cc('bookstore/showEditReturnDetails.sgt?id=${(zeturn.id)!}')">${i18n.getMessage('detailView')}</a>
	- <a href="#" onclick="cc('bookstore/showSearchReturn.sgt')">${i18n.getMessage('search')}</a>
</@showTitle>

<div id="error" style="display:none"></div>

<form action="bookstore/editReturn.sgt" validator="bookstore/validateReturn.sgt" onsubmit="submitFormValidation(this); return false;" onreset="$('error').hide()">
	<table id="dataTable" cellspacing="5" cellpadding="0" align="center">
		<input type="hidden" name="id" value="${(zeturn.id)!}"/>
		<tr>
			<td class="name">${i18n.getMessage('level')}:</td>
			<td>
				<select id="levelId" name="levelId" class="w200">
					<option></option>
					<#list programs as program>
						${request.setAttribute("levels", program.levels)}
						<optgroup label="${program.name}">
							<#list levels as lev>
								<option value="${lev.id}" <#if lev == (level)!>selected</#if>>${lev.name}</option>
							</#list>
						</optgroup>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('date')}:</td>
			<td>
				<input type="text" name="date" value="${(zeturn.date)!}" class="w200"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].date, '${i18n.getMessage('format.date')}', this)"/>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('user')}:</td>
			<td>
				<select name="userId" class="w200">
					<option></option>
					<#list users as user>
						<option value="${(user.id)!}" <#if user == (zeturn.returner)!>selected</#if>>${(user.fullName)!}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name" style="vertical-align:top">${i18n.getMessage('comment')}:</td>
			<td><textarea name="comment" class="w300 h075">${(zeturn.comment)!}</textarea></td>
		</tr>
		<tr>
			<td class="name"></td>
			<td>
				<input type="submit" value="${i18n.getMessage('next')}" class="button_style"/> 
				<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
			</td>
		</tr>
	</table>
</form>

<@ajax.select baseUrl="leveloffering.view" source="levelId" target="offeringId"
	parameters="levelId={levelId}" executeOnLoad=true defaultOptions="${(offering.id)!}"/>